import request from '@/utils/request'

export default {

  // 轮播图背景图片-条件分页查询
  getList(current, size, data) {
    return request({
      url: `/article/background/search/${current}/${size}`,
      method: 'post',
      data
    })
  },
  // 设置背景图片为-启用
  working(id) {
    return request({
      url: `/article/background/working/${id}`,
      method: 'get'
    })
  },
  // 设置背景图片为-停用
  stop(id) {
    return request({
      url: `/article/background/stop/${id}`,
      method: 'get'
    })
  },
  // 根据ID删除
  deleteById(id) {
    return request({
      url: `/article/background/${id}`,
      method: 'delete'
    })
  },
  // 新增背景图片
  add(data) {
    return request({
      url: `/article/background/add`,
      method: 'post',
      data
    })
  },
  // 上传照片到阿里云 OSS (data = {} 给默认值，空对象)
  uploadImg(type, data = {}) {
    return request({
      url: `/article/upload/${type}`,
      method: 'post',
      data
    })
  },
  // 删除阿里云 OSS 图片
  deleteImg(fileUrl) {
    return request({
      url: `/article/upload/delete`,
      method: 'delete',
      params: { 'fileUrl': fileUrl }
    })
  }
}
